/*--------------------------------------------------------------------------------*/
#ifndef __GRAPHIC_FONT_MANAGER__
#define __GRAPHIC_FONT_MANAGER__
/*--------------------------------------------------------------------------------*/
#include "primitives.h"
#include "object.h"
#include "util.h"
#include "map.h"
#include "graphic_font.h"
/*--------------------------------------------------------------------------------*/
class GRAPHIC_FONT_MANAGER : public OBJECT
{

	// -- PUBLIC

public:

    DECLARE_REF( GRAPHIC_FONT_MANAGER );
    DECLARE_SINGLETON( GRAPHIC_FONT_MANAGER );

    // .. CONSTRUCTORS

    GRAPHIC_FONT_MANAGER() : OBJECT(), FontTable()
    {
    }

    virtual ~GRAPHIC_FONT_MANAGER()
    {
    }

    // .. METHODS

    VOID RegisterFont( const TEXT & file_name, const TEXT & font_name )
    {
    	GRAPHIC_FONT::REF
    		font = GRAPHIC_FONT::CreateFromFile( file_name, font_name );

    	DEBUG_Require( !FontTable.HasKey( font_name ) );

    	FontTable.Add( font_name, font );
    }

    const GRAPHIC_FONT & GetFont( const TEXT & name ) const
    {
    	DEBUG_Require( FontTable.HasKey( name ) );

    	return *FontTable[ name ];
    }

    // -- PRIVATE

private :

    // .. ATTRIBUTES

    MAP< TEXT, GRAPHIC_FONT::REF >
    	FontTable;
};
/*--------------------------------------------------------------------------------*/
#define GRAPHIC_FONT_MANAGER_RegisterFont 	GRAPHIC_FONT_MANAGER::GetInstance().RegisterFont
#define GRAPHIC_FONT_MANAGER_GetFont 	GRAPHIC_FONT_MANAGER::GetInstance().GetFont
/*--------------------------------------------------------------------------------*/
#endif
